<script setup lang="ts">

const props = defineProps<{label?: string, icon?: any}>();
</script>

<template>
    <div class="menu-item-box">
        <div class="menu-item-box-left">
            <slot name="left">
                <component v-if="props.icon" :is="props.icon"></component>
            </slot>
        </div>
        <div class="menu-item-box-main">
            <slot name="default">
                <el-text truncated>
                    {{ props.label }}
                </el-text>
            </slot>
        </div>
        <div class="menu-item-box-right">
            <slot name="right"></slot>
        </div>
    </div>
</template>

<style scoped>
.menu-item-box {
    display: flex;
    flex-direction: row;
    width: 100%;
}

.menu-item-box .menu-item-box-left {
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
}

.menu-item-box .menu-item-box-main {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;

    overflow: hidden;
}

.menu-item-box .menu-item-box-right {
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
}
</style>